<html>

	<head>
		<title>店铺配置</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link rel="stylesheet" href="../../css/skin/default/style.css" type="text/css" />
		<link rel="stylesheet" href="../../css/dialog.css">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

 
		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>
		<script src="../../js/JS/layout.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<style>
			a:hover {
				cursor: pointer;
			}
			
			.style1 {
				height: 21px;
			}
		</style>
		<script type="text/javascript">
			var Fsid = $api.getparastr("Fsid");
			var Fname = unescape($api.getparastr("Fname"));
			var yurl = BaseUrl + "SysConfig?token=" + $api.getStorage("token");

			$(function() {
				$("form").ligerForm();
				$("#store").text(Fname);
				initView();

			});

			function initView() {
				var url = yurl + "&Fsid=" + Fsid;
				$api.ajaxget(url, {}, function(obj) {
					for(var i in obj.Data) {
						var data = obj.Data[i];
						if(data.Fcode == 100) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="L100"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="L100"]').eq(1).attr("checked", "checked");

						} else if(data.Fcode == 110) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="L110"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="L110"]').eq(1).attr("checked", "checked");

						} else if(data.Fcode == 120) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="L120"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="L120"]').eq(1).attr("checked", "checked");

						} else if(data.Fcode == 160) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="L160"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="L160"]').eq(1).attr("checked", "checked");

						} else if(data.Fcode == 170) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="L170"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="L170"]').eq(1).attr("checked", "checked");

						} 
					/*	else if(data.Fcode == 180) {
							if(data.Fvalue == 1)
								$('input[type="radio"][name="180"]').eq(0).attr("checked", "checked");
							else
								$('input[type="radio"][name="180"]').eq(1).attr("checked", "checked");

						} */
						else
							$("#" + data.Fcode).val(data.Fvalue);
					}
					$(".rule-multi-radio").ruleMultiRadio();
				});
				$(".rule-multi-radio").ruleMultiRadio();
			}

			function doSaveInfo() {

				if($api.isEmpty($("#130").val())) {
					$.ligerDialog.error("默认收货时长不能为空！");
					return;
				}
				if($api.isEmpty($("#140").val())) {
					$.ligerDialog.error("待付款时长不能为空！");
					return;
				}
				if($api.isEmpty($("#150").val())) {
					$.ligerDialog.error("购物车最多件数！");
					return;
				}
				var ret = $("form").serializeObject();
				console.log(ret);
				var arr = [];
			 	arr.push({
					"Fcode": "100",
					"Fvalue": ret.L100,
					"Fsid": Fsid,
					"Fname": "是否启用积分",
					"Fdesc": "0=不启用 非0则为每消费1元生产多少积分",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "110",
					"Fvalue": ret.L110,
					"Fsid": Fsid,
					"Fname": "是否使用优惠券",
					"Fdesc": "0=不使用 1=使用",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "120",
					"Fvalue": ret.L120,
					"Fsid": Fsid,
					"Fname": "是否开启分销",
					"Fdesc": "0=否 1=是",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "130",
					"Fvalue": $("#130").val(),
					"Fsid": Fsid,
					"Fname": "默认收货时长",
					"Fdesc": "不主动确认收货者，默认收货14天",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "140",
					"Fvalue": $("#140").val(),
					"Fsid": Fsid,
					"Fname": "默认待付款时长",
					"Fdesc": "待付款,默认可保持时间",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "150",
					"Fvalue": $("#150").val(),
					"Fsid": Fsid,
					"Fname": "购物车最多件数",
					"Fdesc": "购物车最多件数可保持件数",
					"Fisstore": true
				});

				arr.push({
					"Fcode": "160",
					"Fvalue": ret.L160,
					"Fsid": Fsid,
					"Fname": "是否启动自提点",
					"Fdesc": "0=不显示 1=显示",
					"Fisstore": true
				});
				arr.push({
					"Fcode": "170",
					"Fvalue": ret.L170,
					"Fsid": Fsid,
					"Fname": "分销模式",
					"Fdesc": "1-普通分销模式 2-代理商分销模式 ",
					"Fisstore": true
				}); 
				/*arr.push({
					"Fcode": "180",
					"Fvalue": $("input[name='180'][checked]").val(),
					"Fsid": Fsid,
					"Fname": "是否启用自提点",
					"Fdesc": "0=不启用 1=启用 ",
					"Fisstore": true
				});*/
				console.log(JSON.stringify(arr));
//				var url  =yurl+"&Fsid="+Fsid; 
//				$api.ajaxarr(url,arr,function(data){
//					
//				});
var param ={
	"Config": JSON.stringify(arr),
	"Fsid":Fsid
}
				 $.ajax({
                    type: "post",
                    url: yurl,
                    data: param,
                    dataType: "json",
                    traditional: true,
                    success: function (obj) {
                    		$api.showLToast("保存成功",3000);
                    		window.history.go(-1);
                    }
               }); 
			}
		</script>
	</head>

	<body class="mainbody">
		<form id="form1" runat="server">
			<!--导航栏-->
			<div class="location" width="300px">
				<table>
					<tr>
						<td class="style1">
							<span style="margin-left:10px">系统设置</span>
							<i class="arrow"></i>
							<span class="nows">运营配置</span> </td>
					</tr>
				</table>
			</div>

			<div class="line10"></div>

			<div class="div-content">
				<div class="divhead">填写<span id="store" style="color:red">飞协科技</span>基本信息</div>
				<hr class="divline" />

				<dl>
					<dt>是否启用积分</dt>
					<dd>
						<div style="float:left;" class="rule-multi-radio">
							<label><input type="radio" value="1" checked="checked"  name="L100">是</label>
							<label><input type="radio" value="0"  name="L100">否</label>
						</div>
						<div style="float:left;margin-left:10px;top:10px;">*为每消费1元生产多少积分</div>
					</dd>
				</dl>
				<dl>
					<dt>是否使用优惠券</dt>
					<dd>
						<div style="float:left;" class="rule-multi-radio">
							<label><input type="radio" value="1" checked="checked"  name="L110">是</label>
							<label><input type="radio" value="0"  name="L110">否</label>
						</div>
					</dd>
				</dl>
				<dl>
					<dt>是否开启分销</dt>
					<dd>
						<div style="float:left;" class="rule-multi-radio">
							<label><input type="radio" value="1" checked="checked"  name="L120">是</label>
							<label><input type="radio" value="0"  name="L120">否</label>
						</div>
					</dd>
				</dl>
				<dl>
					<dt>分销模式</dt>
					<dd>
						<div style="float:left;" class="rule-multi-radio">
							<label><input type="radio" value="1" checked="checked"  name="L170">普通分销</label>
							<label><input type="radio" value="2"  name="L170">代理商分销</label>
						</div>
					</dd>
				</dl>

				<dl>
					<dt>是否启用自提点</dt>
					<dd>
						<div style="float:left;" class="rule-multi-radio">
							<label><input type="radio" value="1" checked="checked"  name="L160">启用</label>
							<label><input type="radio" value="0"  name="L160">不启用</label>
						</div>
					</dd>
				</dl>
				<dl ID="div_sppp">
					<dt>默认收货时长</dt>
					<dd>
						<div style="float:left"><input id="130" type="text" id="130" value="14" ltype="text" ligerui="{width:100,digits:true}" />
						</div>
						<div style="float:left"><span class="Validform_checktip">*不主动确认收货者，默认收货14天 </span>
						</div>
					</dd>
				</dl>
				<dl>
					<dt>待付款时长</dt>
					<dd>
						<div style="float:left">
							<input id="140" type="text" id="140" value="30" ltype="text" ligerui="{width:100,digits:true}" validate="{required:true}" />
						</div>
						<div style="float:left"><span class="Validform_checktip">*待付款,默认可保持时间 </span>
						</div>
					</dd>
				</dl>
				<dl>
					<dt>购物车最多件数</dt>
					<dd>
						<div style="float:left">
							<input id="150" type="text" id="150" value="200" ltype="text" ligerui="{width:100,digits:true}" validate="{required:true}" />
						</div>
						<div style="float:left"><span class="Validform_checktip">*购物车最多件数	购物车最多件数可保持件数</span>
						</div>
					</dd>
				</dl>

			</div>

			<div align="center" style="margin:20px;">
				<div style="margin-top:20px"> <input style="width:150px;display:inline" type="button" ID="btnSubmit" value="保存" class="btn" onclick="doSaveInfo();" />
			 
			</div>
			<div class="div-content" style="margin-top: 10px;width:99.5%">
				<div class="divhead">信息管理小贴士</div>
				<hr class="divline" />
				<div style="padding:1px 5px; line-height:22px;"><span style="color:#FD0036">请在开通商户是设置该数据，原则上不允许修改，修改后将重新收取费用。</span>

		</form>
	</body>

</html>